//
//  YLAHomeCell.swift
//  Your Lover AI
//
//  Created by 阿忠 on 2024/6/21.
//

import UIKit

class YLAHomeCell: UICollectionViewCell {
    
    //背景
    lazy var backVc: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(white: 1.0, alpha: 0.5)
        view.layer.cornerRadius = 10.0 // 设置圆角半径为10.0
        view.layer.masksToBounds = true
        return view
    }()
    
    //图片
    lazy var iconImg: UIImageView = {
        let image = UIImageView(image: UIImage(named: "home-rodia"))
        image.contentMode = .scaleAspectFill
        return image
    }()
    
    //名字
    lazy var nameLab: UILabel = {
        let lab = UILabel()
        lab.text = "Elizabeth Morgan"
        lab.textColor = .white
        lab.font = UIFont.systemFont(ofSize: 13, weight: .bold)
        lab.textAlignment = .left
        lab.numberOfLines = 0
        return lab
    }()
    
    //简介
    lazy var contentLab: UILabel = {
        let lab = UILabel()
        lab.text = "Intimidating yet intriguing professor, often spotted engr…"
        lab.textColor = .white
        lab.font = UIFont.systemFont(ofSize: 12)
        lab.textAlignment = .left
        lab.numberOfLines = 0
        lab.alpha = 0.8
        return lab
    }()
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        contentView.backgroundColor = .clear
        contentView.addSubview(backVc)
        backVc.addSubview(iconImg)
        iconImg.addSubview(nameLab)
        backVc.addSubview(contentLab)
        initUI()
    }
    
    func initUI()
    {
        backVc.snp.makeConstraints { make in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.top.equalTo(0)
            make.bottom.equalTo(0)
        }
        
        iconImg.snp.makeConstraints { make in
            make.left.top.right.equalToSuperview()
            make.bottom.equalTo(-70)
        }
        
        nameLab.snp.makeConstraints { make in
            make.left.equalTo(iconImg).offset(10)
            make.right.equalTo(iconImg).offset(-10)
            make.bottom.equalTo(iconImg).offset(-10)
        }
        
        contentLab.snp.makeConstraints { make in
            make.left.equalTo(10)
            make.right.equalTo(-10)
            make.top.equalTo(iconImg.snp.bottom).offset(10)
            make.bottom.equalTo(-10)
        }
        
    }
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
